package com.jrx.anytxn.reporting.job.lsSecondFile.step;

import com.jrx.anytxn.reporting.config.LSFileConfig;
import com.jrx.anytxn.reporting.constant.ReportingConstant;
import com.jrx.anytxn.reporting.service.ILSFileService;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 生成第二代征信个人合同信息 Listener
 *
 * @author liuyang
 * @date 2021-04-26
 */
@Service
public class LSSecondContractFileListener implements JobExecutionListener {

    @Autowired
    private LSFileConfig fileConfig;
    @Autowired
    private ILSFileService fileService;

    @Override
    public void beforeJob(JobExecution jobExecution) {

        String reportingPath = fileConfig.getLsSecondFilePath();
        String fileName = fileConfig.getLsFileName();

        fileService.createDirectoriesAndFile(reportingPath, fileName, ReportingConstant.LS_SECOND_FILE_ACCTCTRCT, ReportingConstant.LS_SECOND_FILE_SUFFIX);
    }

    @Override
    public void afterJob(JobExecution jobExecution) {

    }
}
